package com.weixstudio.designmode.facade.demo_1;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * @ClassName FileWriter
 * @Description 读取文件
 * @Author liangw
 * @Date 2022/4/23 16:43
 * @Version 1.0
 **/
public class FileWriter {

    public void write(String encryptStr,String fileNameDes){
        System.out.println("保存密文，写入文件");
        try {
            FileOutputStream outFs = new FileOutputStream(fileNameDes);
            outFs.write(encryptStr.getBytes());
            outFs.close();
        } catch (FileNotFoundException e) {
            System.out.println("文件不存在！");
        } catch (IOException e) {
            System.out.println("文件操作错误！");
        }
    }
}
